﻿
@{
    Layout = null;
}



<!DOCTYPE html>
<html data-use-rem="750">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="format-detection" content="telephone=no, email=no">
    <title>产品三包防伪扫码</title>
    <link rel="stylesheet" href="/Content/ty/reset-h5.css">
    <link rel="stylesheet" href="/Content/ty/index.css">
    <link rel="stylesheet" href="/Content/ty/swiper.css">
    <style>
        .swiper-container img {
            height:auto;
        }
    </style>
</head>

<body>
    <div class="swiper-container" >
        <div class="swiper-wrapper" id="swiper-wrapper">
            <img src="https://api.whtxqp.com/fl/20200804/2001662100.jpg"   class="swiper-slide" />
            <img src="https://api.whtxqp.com/fl/20200804/762686667.jpg"   class="swiper-slide" />
        </div>
        <div class="swiper-pagination"></div>
    </div>
    <div class="bigbox">
        <!--<div class="input-box">
            <div class="tit">扫码查询</div>
            <div class="saoma" id="scan"></div>
        </div>-->
        <div class="input-box">
            <div class="tit">输码查询</div>
            <input placeholder="" class="search-input" value="@ViewBag.Code" /><span class="search-btn">查询</span>
        </div>
    </div>
    <div class="fwResult" id="fwresult" style="display: none;"></div>
    <div class="ts-box1">
        <h1>温馨提示:</h1>
        <p>为保障您的三包权益，请认真阅读三包准则及注意第一次查询结果。</p>
        <p>第一次扫码日期即为三包售后服务开始日期。</p>
    </div>

    <!--<div class="ts-box2">
        <h1>查询方法:</h1>
        <p>1、扫码关注官方微信公众号。</p>
        <p>
            2、关注后，点击产品防伪中的防伪查询，扫码或手输20位数码，即可查询真伪信息。
        </p>
        <p>3、查询结果与实物信息对比，判别真伪。</p>
        <p>4、原旧版防伪标查询，请刮开涂层，手动输入12位防伪码，只可查询真伪信息（无产品信息）。</p>
    </div>-->

    <script src="/Content/ty/rem.js"></script>
    <script src="/Content/ty/jquery.min.js"></script>
    <script src="/Content/ty/swiper.min.js"></script>
    
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script>
        
        
			var swiper = new Swiper('.swiper-container', {
				pagination: '.swiper-pagination',
				paginationClickable: true,
				spaceBetween: 0,
				centeredSlides: true,
				autoplay: 3000,
				autoplayDisableOnInteraction: false
			});

			 

			$('.search-btn').click(function() {
				var code = $('.search-input').val();
				if(code == "") {
					alert('请输入防伪码');
					return;
				}

				query(code);
			});

			function query(code) {
			 
				jQuery.ajax({
					type: "get",
                    url: "/API/GetCKCate",
                    data: "Code=" + code,
                    contentType: "application/json;charset=UTF-8",
                    success: function (rs)
                    {
                        
                        var json = jQuery.parseJSON(rs);
                        if (json.Status == 100) {
                            $('.fwResult').show();
                            //$('.ts-box1').hide();
                            //$('.ts-box2').hide();

                            var sortInfo = json.Data.sortInfo;
                            var cateInfo = json.Data.cateInfo;
                            var logInfo = json.Data.logInfo;
                            var s = "<br>" + sortInfo.Title + "</br>";                            
                            $('#fwresult').html("感谢您的支持，此产品三包从今天开始。<br>本次为第" + logInfo.Num+"次查询，开始日期" + shortDate(logInfo.CreateDate));
                        }
                        else
                        {
                            $('.fwResult').show();
                            //$('.ts-box1').hide();
                            //$('.ts-box2').hide();
                            $('#fwresult').html("抱歉，查无此码，不能正常享受三包");
                        }
						
					}
				});

				 
			}

        function shortDate(date) {
            var date = new Date(date);
            var year = date.getFullYear();
            var month = date.getMonth() + 1;
            var day = date.getDate();

            var hour = date.getHours();
            var min = date.getMinutes();

            return [year, month, day].join('-');
        }
        jQuery(document).ready(function ()
        {
            //LinkList
            jQuery.ajax({
                type: "get",
                url: "/API/LinkList",
                data: { ShopID: 0, SortID: 18, keyword:""},
                contentType: "application/json;charset=UTF-8",
                success: function (rs)
                {

                    var json = jQuery.parseJSON(rs);
                    if (json.Status == 100)
                    {
                        if (json.Data.length > 0) {
                            var s = "";
                            json.Data.map(function (item, i) {
                                s += "<img src='" + item.ImageUrl + "'   class=\"swiper-slide\" />";
                            });
                            jQuery("#swiper-wrapper").html(s);
                            jQuery(".swiper-container").show();
                        }
                        else {
                            jQuery(".swiper-container").hide();
                        }
                    }
                }
            });

            var s = "@ViewBag.Code";
            if (s != "") {
                query(s);
            }
            
        });
    </script>
</body>

</html>
